/*******************************************************************************
 * Copyright (c) 2011 - 2014, 2018 ACIN, fortiss GmbH
 *               2018 Johannes Kepler University
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *   Alois Zoitl - initial API and implementation and/or initial documentation
 *   Alois Zoitl - migrated fb tests to boost test infrastructure
 *******************************************************************************/
#include "../../core/fbtests/fbtestfixture.h"
#include "forte/datatypes/forte_bool.h"

using namespace forte::literals;

namespace forte::iec61499::events::test {
  struct E_PERMIT_TestFixture : public forte::test::CFBTestFixtureBase {

      E_PERMIT_TestFixture() : CFBTestFixtureBase("iec61499::events::E_PERMIT"_STRID) {
        setInputData({&mInPERMIT});
        setup();
      }

      CIEC_BOOL mInPERMIT; // DATA INPUT
  };

  BOOST_FIXTURE_TEST_SUITE(PermitTests, E_PERMIT_TestFixture)

  BOOST_AUTO_TEST_CASE(permit) {
    mInPERMIT = true_BOOL;
    triggerEvent(0);
    BOOST_CHECK(checkForSingleOutputEventOccurence(0));
  }

  BOOST_AUTO_TEST_CASE(dontPermit) {
    mInPERMIT = false_BOOL;
    triggerEvent(0);
    BOOST_CHECK(eventChainEmpty());
  }

  BOOST_AUTO_TEST_SUITE_END()
} // namespace forte::iec61499::events::test
